//
//  thirViewController.m
//  豆瓣综合网页
//
//  Created by dllo on 15/12/31.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "thirViewController.h"
#import "thirdTableViewCell.h"
#import "Model2.h"
@interface thirViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, retain)UITableView *tableView;
@property (nonatomic, retain) NSArray *arr;
@property (nonatomic, retain) NSMutableArray *arrModel;

@end

@implementation thirViewController
- (void)dealloc
{
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:_tableView];
    [_tableView release];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    NSString *path = [[NSBundle mainBundle] pathForResource:@"cinema" ofType:@"plist"];
    self.arr = [NSMutableArray arrayWithContentsOfFile:path];
    self.arrModel = [NSMutableArray array];
    for (NSDictionary *dic in _arr) {
        Model2 *mode = [Model2 model2];
        [mode setValuesForKeysWithDictionary:dic];
        [_arrModel addObject:mode];
    }
    self.navigationItem.title = @"影院";
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:86/255.0 green:137/255.0 blue:156/255.0 alpha:1];
    [self.tableView registerClass:[thirdTableViewCell class] forCellReuseIdentifier:@"cell"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _arr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
       thirdTableViewCell *cell = [[thirdTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    Model2 *model = _arrModel[indexPath.row];
    cell.addresslabel.text =model.address;
    cell.cinemaNamelabel.text = model.cinemaName;
    cell.telephonelabel.text = model.telephone;
    cell.imgView.image = [UIImage imageNamed:@"bg_eventlistcell.png"];

    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 200;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
